<?php
	/**
	 * Deze functie genereert een standaard HTML header	 
	 */
	function ShowHeader() {
		echo "<!DOCTYPE HTML>";
		echo "<html>";
		echo "	<head>";
		echo "<meta charset='utf-8'>";
		echo "<meta name='viewport' content='width=device-width, target-densitydpi=device-dpi' /> ";
		echo "<link rel='stylesheet' href='/".REALROOT."/css/stijl.css' type='text/css'	/>";
		echo "<link rel='shortcut icon' href='/".REALROOT."/images/favicon.ico' />";
		echo "		<title>".PageTitle()."</title>";
		echo "		<script type='text/javascript' src='/".REALROOT."/js/general.js'></script>";
		echo "		<script src='http://widgets.twimg.com/j/2/widget.js'></script>";
		echo "<script src='http://widgets.twimg.com/j/2/widget.js'></script>";
		echo "	</head>";
		echo "	<body>";
		ShowNavigation();
		echo "		<div id='wrapper'>";
		ShowTree();
		ShowLogo();
		
	}
		/** 
	 * Deze functie laat het navigatiemenu zien 
	 */
	function ShowNavigation() {
		echo "<div id='header'>";
		echo "<ul id='navigation'>";
		ShowLink("HOME");
		ShowLink("ABOUTTED");
		ShowLink("SPEAKERS");
		ShowLink("NEWS");
		ShowLink("SUBSCRIBE");
		echo "</ul>";
		ChooseLanguage();
		echo "</div>";
	}
	function ShowLink($page) {
		if($_GET['page'] == ucwords(strtolower($page))) {
			$css = "id='active'";
		}
		else {
			$css = "class='button'";
		}
		echo "	<li ><a $css href='/".REALROOT."/".$_GET['lang']."/".ucwords(strtolower($page))."/'>";
		echo constant($page);
		echo "</a></li>";
	}
	/**
	 * Deze functie zorgt ervoor dat gebruikers een taal kunnen kiezen
	 * Let op! Door de float: right in de css komt de onderste link aan de linkerkant geplaatst.
	 * De volgorde is dus omgekeerd
	 */
	function ChooseLanguage() {
		echo "<ul id='languages'>";
		ShowLanguage("Nederlands");
		ShowLanguage("English");
		echo "</ul>";
	}
	function ShowLanguage($lang) {
		if($_GET['lang'] != $lang) {
			echo "	<li class='lang'><a href='/".REWRITEROOT."/$lang/".CurrentPage()."/'>$lang</a></li>";
		}
	}
	/***
	* Laat hanze tedx logo zien.	
	*/
	function ShowLogo()	{
		echo "<div id='logo'>	 ";
		echo "<a href='/'><img src='/".REALROOT."/images/logo.png' alt='TEDxHanzeUniversity'/>";
		echo "</a>				 ";
		echo "</div>			 ";			
	}
	
	/***
	*Functie voor het laten zien van rode boom aan linker zijde
	*/
	function ShowTree()	{
		echo "<div id='tree'>";
		TwitterFeed();
		echo "</div>";	
		
	}
	function TwitterFeed() {
		echo "	<div id='twitterfeed'>
					<script>
					new TWTR.Widget({
					  version: 2,
					  type: 'search',
					  search: 'TEDx',
					  interval: 30000,
					  title: 'Live Twitter Feed',
					  subject: 'TEDxHanzeUniversity',
					  width: 250, height: 250,
					  theme: {
						shell: {
						  background: '#ff2a06',
						  color: '#ffffff'
						},
						tweets: {
						  background: '#ffffff',
						  color: '#444444',
						  links: '#ff2a06'
						}
					  },
					  features: {
						scrollbar: false,
						loop: true,
						live: true,
						behavior: 'default'
					  }
					}).render().start();
					</script>
				</div>";
	}
	
	/***
	*	Laat content zien , inclusief artikelen en media.
	*/
	
	function ShowArticleRow($input) {
	echo "<div class='articlerow'>";	
	if(is_callable($input)) {
		call_user_func($input);
	}
	else {
		echo $input;
	}
	echo "</div>";
	}
	function ShowFullPageArticle($input) {
	echo "<div class='fullpagearticle'>";	
	if(is_callable($input)) {
		call_user_func($input);
	}
	else {
		echo $input;
	}
	echo "</div>";
	}
	function ShowAbout() {
		ShowFullPageArticle("<p>About TEDx, x = independently organized event</p>

				<p>In the spirit of ideas worth spreading, TEDx is a program of local, 
				self-organized events that bring people together to share a TED-like experience. 
				At a TEDx event, TEDTalks video and live speakers combine to spark deep discussion and connection in a small group. These local,	self-organized events are branded TEDx, where x = independently organized TED event. 
				The TED Conference provides general guidance for the TEDx program, but individual TEDx events are self-organized. 
				(Subject to certain rules and regulations.)</p>

				<h2>About TED</h2>
				<p>TED is a nonprofit organization devoted to Ideas Worth Spreading. Started as a four-day conference in California 25 years ago,
				TED has grown to support those world-changing ideas with multiple initiatives. 
				The annual TED Conference invites the world's leading thinkers and doers to speak for 18 minutes. 
				Their talks are then made available, free, at TED.com. 
				TED speakers have included Bill Gates, Al Gore, Jane Goodall, Elizabeth Gilbert, Sir Richard Branson, Nandan Nilekani, Philippe Starck, 
				Ngozi Okonjo-Iweala, Isabel Allende and UK Prime Minister Gordon Brown. 
				The annual TED Conference takes place in Long Beach, California, with simulcast in Palm Springs; 
				TEDGlobal is held each year in Oxford, UK. 
				TED's media initiatives include TED.com, where new TEDTalks are posted daily, and the Open Translation Project, 
				which provides subtitles and interactive transcripts as well as the ability for any TEDTalk to be translated by volunteers worldwide. 
				TED has established the annual TED Prize, 
				where exceptional individuals with a wish to change the world are given the opportunity to put their wishes into action; 
				TEDx, which offers individuals or groups a way to organize local, independent TED-like events around the world; 
				and the TEDFellows program, helping world-changing innovators from around the globe to become part of the TED community and, 
				with its help, amplify the impact of their remarkable projects and activities.</p>

				<p>Follow TED on Twitter at twitter.com/TEDTalks, or on Facebook at facebook.com/TED.</p>

				<p>TED2011, \"The Rediscovery of Wonder,\" will be held February 28-March 4, 2011, in Long Beach, California,
				 with the TEDActive simulcast in Palm Springs, California.</p>");
	}
	
	/**
	 * Deze functie genereert een standaard HTML footer
	 */
	function ShowFooter() {
		echo "	</div>";
		echo " <div id='footer'>";
		echo "<ul id='footerlinks'>";
		echo "	<li><a href='http://".URL."'>Home</a></li>";
		echo "	<li><a href='http://validator.w3.org/check?uri=http%3A%2F%2F".URL."%2F".REWRITEROOT."%2F;st=1' target='_blank'>Valid HTML5</a></li>";
		echo "</ul>";
		echo "	<a href='https://www.facebook.com/TEDxEvents' target='_blank'><img src='/".REALROOT."/images/f_logo.png' id='f_logo' alt='Find us on Facebook' class='socialmedia'/></a>"; //facebook logo
		echo "	<a href='https://twitter.com/#!/TedxHanzeUniv' target='_blank'><img src='/".REALROOT."/images/t_logo.png' id='t_logo' alt='Find us on Twitter' class='socialmedia'/></a>"; //twitter logo
		echo "<p id='license'>This independent TEDx event is operated under license from TED.</p>";
		echo "		</div>";
		echo "	</body>";
		echo "</html>";
		
	}
	
	/**
	 * Deze functie wordt gebruikt om de huidige actie te bepalen
	 * als er geen actie is opgegeven in de url dan wordt de config 
	 * standaard actie gebruikt.
	 *
	 */
	function CurrentPage() {
		
		if(isset($_GET['page'])) {
			return $_GET['page'];
		}
		else {
			return "Home";
		}
	}
	function PageTitle () {
		$CurrentPage = CurrentPage();
		$CurrentPage = constant(strtoupper($CurrentPage))." TEDxHanzeUniversity";
		return $CurrentPage;
	}

?>